package com.pan.kang.demo.res;


import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class Response<T> {

    private Integer code = BaseCode.OK.getCode();

    private String message = BaseCode.OK.getMessage();

    private T data;

    public Response(T data) {
        super();
        this.data = data;
    }

    public Response(BaseEnum baseEnum) {
        super();
        this.code = baseEnum.getCode();
        this.message = baseEnum.getMessage();
    }

    public Response(Integer code, String message) {
        super();
        this.code = code;
        this.message = message;
    }

    public Boolean success() {
        if (this.code.equals(BaseCode.OK.getCode())) {
            return true;
        }
        return false;
    }

}
